home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Double Buffer Demo
- ** ------------------
- ** This simple demo shows how to double buffer the screen.
- **
- ** To compile with SAS/C:
- **
- ** 1> sc DoubleBuffer.c link startup=LIB:GMSMain.o data=far
- **
- */
-
- #include <proto/games.h>
-
- extern struct GMSBase *GMSBase;
- ULONG _XCEXIT = NULL;
- ULONG PREFSNAME = DEFAULT;
-
- void main(void)
- {
- struct Picture *picture;
- struct GameScreen *screen;
-
- if (picture = LoadPicFile("GMS:demos/data/PIC.Green",GETPALETTE|VIDEOMEM)) {
-
- if (screen = AddScreenTags(TAGS_GAMESCREEN,NULL,
- GSA_MemPtr1, picture->Data,
- GSA_Planes, picture->Planes,
- GSA_ScrMode, picture->ScrMode,
- GSA_ScrType, picture->ScrType,
- GSA_ScrWidth, picture->Width,
- GSA_ScrHeight,picture->Height,
- GSA_Palette, picture->Palette,
- GSA_Attrib, DBLBUFFER|CENTRE,
- TAGEND)) {
-
- ShowScreen(screen);
- while (!(ReadMouse(JPORT1)&MB_LMB)) {
- WaitVBL();
- SwapBuffers(screen);
- }
- FreePic(picture);
- }
- DeleteScreen(screen);
- }
- }
-
-